import { Message, MessageBox  } from 'element-ui';

const el = {
  // 消息提示
  success: function(message) {
		Message.success({
			message: message || 'message',
			type: 'success',
			duration: 1000
		});
	},
	info: function(message) {
		Message.info({
			message: message || 'message',
			type: 'info',
			duration: 1000
		});
	},
	warning: function(message) {
		Message.warning({
			message: message || 'message',
			type: 'warning',
			duration: 1000
		});
	},
	error: function(message) {
		Message.error({
			message: message || 'message',
			type: 'error',
			duration: 1000
		});
	},
	// 弹框
	alert(message, options = {}) {
		MessageBox.alert(message, {
			title: options.title || '提示',
			confirmButtonText: '确定',
			dangerouslyUseHTMLString: options.isHTML || false,
			customClass: options.class,
			callback: action => {
				options.callback ? options.callback(action) : false;
			}
		})
	},
}

export default el;